<?php
/**
 * Created by PhpStorm.
 * User: yuguozhen
 * Date: 16/8/1
 * Time: 上午10:10
 */
namespace models\Timer\Count;
class PatientInhospitalReadingDetailModel extends \models\PatientInhospitalReadingDetailModel{

    //每日新增推送课程阅读量
    public function READ_PUSH_CLASS($prev_start,$prev_end){
        return  $this->PUSH_CLASS($prev_start,$prev_end,0);
    }

    //每日新增推送课程疑问量
    public function QUESTION_PUSH_CLASS($prev_start,$prev_end){
        return $this->PUSH_CLASS($prev_start,$prev_end,1);
    }

    public function PUSH_CLASS($prev_start,$prev_end,$qtype){
        $count = $this->where('question','=',$qtype)
            ->where('read_date','>=',$prev_start)
            ->where('read_date','<=',$prev_end)
            ->count();

        $sql = "select count(1) from `patient_inhospital_reading_detail` where question = '".$qtype."' and read_date >= ".$prev_start." and read_date >= ".$prev_end;
//        $errpath = $this->config->logs->exec_timer_static_sql;
//        $this->monolog('exec_sql_static',$errpath,$level=\Monolog\Logger::INFO,$content=$sql,$slevel='info');

        return $count;
    }

}